package view;
/**
 * Created by CatScan on 2016/6/19.
 */

import domain.ATM;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class MainApp extends Application {
    public static String viewResRoot = "res/";

    public static String mainViewID = "ATMView";
    public static String passwordViewID = "PasswordView";
    public static String cardReaderViewID = "CardReaderView";
    public static String balanceViewID = "BalanceView";
    public static String depositViewID = "DepositView";
    public static String withdrawalViewID = "WithdrawalView";
    public static String messageViewID = "MessageView";
    public static String receiptViewID = "ReceiptView";
    public static String isToPrintReceiptViewID = "IsToPrintReceiptView";

    public static String mainViewRes = idToRes(mainViewID);
    public static String passwordViewRes = idToRes(passwordViewID);
    public static String cardReaderViewRes = idToRes(cardReaderViewID);
    public static String balanceViewRes = idToRes(balanceViewID);
    public static String depositViewRes = idToRes(depositViewID);
    public static String withdrawalViewRes = idToRes(withdrawalViewID);
    public static String messageViewRes = idToRes(messageViewID);
    public static String receiptViewRes = idToRes(receiptViewID);
    public static String isToPrintReceiptViewRes = idToRes(isToPrintReceiptViewID);

    public static String idToRes(String id){
        return viewResRoot + id + ".fxml";
    }

    private StageController stageController;




    @Override
    public void start(Stage primaryStage) {

        //新建一个StageController控制器
        stageController = new StageController();

        //将主舞台交给控制器处理
        stageController.setPrimaryStage("primaryStage", primaryStage);

        //加载两个舞台，每个界面一个舞台
//        stageController.loadStage(passwordViewID, passwordViewRes, StageStyle.DECORATED);
//        stageController.loadStage(mainViewID, mainViewRes);
        stageController.loadStage(cardReaderViewID, cardReaderViewRes);
        stageController.loadStage(isToPrintReceiptViewID, isToPrintReceiptViewRes);
//        stageController.loadStage(balanceViewID, balanceViewRes);
//        stageController.loadStage(depositViewID, depositViewRes);
//        stageController.loadStage(withdrawalViewID, withdrawalViewRes);
//        stageController.loadStage(messageViewID, messageViewRes);

        //显示MainView舞台
        stageController.setStage(cardReaderViewID);
    }


    public static void main(String[] args) {
        launch(args);
    }
}